package weifei.live.simulation.entity;


import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.springframework.stereotype.Repository;

import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = true)
@TableName("chat_group")
@Repository
public class ChatGroup extends Model<ChatGroup>
{
    @Getter
    public enum Column
    {
        ID("id"),
        OwnerID("owner_id"),
        AvatarID("avatar_id"),
        Name("name"),
        AdminerCapacity("adminer_capacity"),
        CreateTime("create_time");

        final String name;
        Column(String name) { this.name = name; }
    }

    @TableId
    private Integer id;
    @NotNull
    private Integer ownerId;
    private Integer avatarId;
    @NotBlank @NotNull
    private String name;
    private Integer adminerCapacity;
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;


    /** 做数据库修改用 */
    public ChatGroup() {}
    public ChatGroup(int id) { this.id = id; }  // selectByID，deleteByID
    public ChatGroup(
            int ownerId,
            String name
    )
    {
        this.ownerId = ownerId;
        this.name = name;
    }
}





